/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Types;

/**
 *
 * @author majidrastegar-mojarad
 */
public class Entity {

    String id;
    String charOffset;
    int charOffset_start;
    int charOffset_end;
    int charOffset_start_2;
    int charOffset_end_2;
    String type;
    String text;

    public Entity() {
    }

    public int getCharOffset_end_2() {
        return charOffset_end_2;
    }

    public void setCharOffset_end_2(int charOffset_end_2) {
        this.charOffset_end_2 = charOffset_end_2;
    }

    public int getCharOffset_start_2() {
        return charOffset_start_2;
    }

    public void setCharOffset_start_2(int charOffset_start_2) {
        this.charOffset_start_2 = charOffset_start_2;
    }

    
    
    public String getCharOffset() {
        return charOffset;
    }

    public void setCharOffset(String charOffset) {
        this.charOffset = charOffset;
        charOffsetSetter();
    }

    private void charOffsetSetter() {
        try {
            if (charOffset.indexOf(";") < 0) {
                String[] tem = charOffset.split("-");
                charOffset_start = Integer.parseInt(tem[0]);
                charOffset_end = Integer.parseInt(tem[1]);
                charOffset_start_2 = -1;
                charOffset_end_2 = -1;
            } else {
                String[] tem = charOffset.split(";");
                String[] p = tem[0].split("-");
                charOffset_start = Integer.parseInt(p[0]);
                charOffset_end = Integer.parseInt(p[1]);
                p = tem[1].split("-");
                charOffset_start_2 = Integer.parseInt(p[0]);
                charOffset_end_2 = Integer.parseInt(p[1]);
            }
        } catch (Throwable t) {
//            System.out.println(id);
//            System.out.println(charOffset);
//            System.out.println("Error in charOffsetSetter");
        }

    }

    public int getCharOffset_start() {
        return charOffset_start;
    }

    public void setCharOffset_start(int charOffset_begin) {
        this.charOffset_start = charOffset_begin;
    }

    public int getCharOffset_end() {
        return charOffset_end;
    }

    public void setCharOffset_end(int charOffset_end) {
        this.charOffset_end = charOffset_end;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
